<template>
  <div class="cart">
    <!--顶部导航-->
    <TopNav class="topNav">
      <div slot="center">购物车({{cartLength}})</div>
    </TopNav>
    <!--商品列表-->
    <CartList/>
    <!--底部汇总-->
    <CartBottomBar/>
  </div>
</template>

<script>
  import TopNav from "../../components/common/topnav/TopNav";

  import CartList from "./childComponents/CartList"
  import CartBottomBar from "./childComponents/CartBottomBar";

  import {mapGetters} from "vuex"

  export default {
    name: "Cart",
    components: {
      CartList,
      CartBottomBar,
      TopNav
    },
    computed: {
      //将getters中的方法转化成计算属性
      ...mapGetters(['cartLength'])
    }
  }
</script>

<style scoped>
  .cart {
    height: 100vh;
  }
  .topNav {
    background-color: var(--color-tint);
    color: #fff;
    font-weight: 600;
  }
</style>
